<script language="javascript" type="text/javascript" src="/javascripts/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
	theme : "advanced",
	theme_advanced_buttons1 : "bold,italic,underline,bullist,numlist,link,anchor,code",
	theme_advanced_buttons2 : "",
	theme_advanced_buttons3 : "",
	mode : "textareas"
});
</script>

<% form_for(:vail, :url => vail_path(@vail), :html => { :method => :put }) do |f| %>
	<fieldset>
		<legend>Edit "<%= @vail.name %>"</legend>
		<br/>
		<%= error_messages_for :vail %>
	  <p>
			<label for="name">Name</label>
			<br/>
	    <%= f.text_field :name, :class => :input_line %>
	  </p>
	  <p>
	    <label for="headline">Headline</label>
			<br/>
	    <%= f.text_field :headline, :class => :input_line %>
	  </p>
	  <p>
	    <label for="body">Body</label>
			<br/>
	    <%= f.text_area :body %>
	  </p>
	
		<% unless Datasheet.find(:all).empty? %>
		<p>
			<label for="datasheets">Available Datasheets</label>
			<% Datasheet.find(:all).each do |datasheet| %>
				<div class="datasheet">
					<%= check_box_tag "vail[datasheet_ids][]", datasheet.id, @vail.datasheets.include?(datasheet) %>
					<%= link_to datasheet.name, datasheet.public_filename %>
				</div>
			<% end %>
		</p>
		<% end %>
	
	  <ul class="right">
			<li class="horizontal"><%= link_to "Cancel", path_for_vail(@vail) %></li>
			<li class="horizontal">|</li>
	    <li class="horizontal"><%= submit_tag "Ok" %></li>
	  </ul>
		<br/>
	</fieldset>
<% end %>